using System;
using Newtonsoft.Json;

namespace FBGraph.Models
{
    /// <summary>A message in the user's inbox, outbox or updates</summary>
    public partial class MailboxItem : IFBGraphResult
    {
        /// <summary>The Graph API id of the <see cref="MailboxItem" /></summary>
        [JsonPropertyAttribute("id")]
        public Int64 Id { get; set; }
        
        /// <summary>A <see cref="From" /> object describing the <see cref="User" /> or <see cref="Page" /> that sent the <see cref="MailboxItem" /></summary>
        [JsonPropertyAttribute("from")]
        public From From { get; set; }
        
        /// <summary>A collection of recipients of the <see cref="MailboxItem" /></summary>
        [JsonPropertyAttribute("to")]
        public PagedResult<To> To { get; set; }
        
        /// <summary>The subject of the <see cref="MailboxItem" /></summary>
        [JsonPropertyAttribute("subject")]
        public String Subject { get; set; }
        
        /// <summary>The message body of the <see cref="MailboxItem" /></summary>
        [JsonPropertyAttribute("message")]
        public String Message { get; set; }
        
        /// <summary>The date and time that the <see cref="MailboxItem" /> was last updated</summary>
        [JsonPropertyAttribute("updated_time")]
        public DateTime UpdatedTime { get; set; }
        
        /// <summary>A collection of comments about the <see cref="MailboxItem" /></summary>
        [JsonPropertyAttribute("comments")]
        public PagedResult<Comment> Comments { get; set; }
        
        /// <summary>Gets or sets a <see cref="Boolean" /> value representing whether the object has been populated.</summary>
        Boolean IFBGraphResult.IsReady { get; set; }
        /// <summary>Updates the current model with values from another like-typed model.</summary>
        /// <param name="other">The source model.</param>
        /// <remarks>This is used for asynchronous calls to update the reference that was returned when the original API method was called.</remarks>
        void IFBGraphResult.UpdateFrom(IFBGraphResult other)
        {
            var that = other as MailboxItem;
            if (that == null) return;
            else
            {
                this.Id = that.Id;
                this.From = that.From;
                this.To = that.To;
                this.Subject = that.Subject;
                this.Message = that.Message;
                this.UpdatedTime = that.UpdatedTime;
                this.Comments = that.Comments;
                ((IFBGraphResult)this).IsReady = true;
            }
            
        }
    }
}